<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // function Person() {
        //     // this.sayHi = function () {
        //     //     console.log('嗨！' + this.name);

        //     // }
        // }

        // // 添加方法
        // Person.prototype.sayHi = function () {
        //     console.log("Hi~" + this.name);
        // }

        // // 添加属性
        // Person.prototype.name = '小明'

        // let pl = new Person()
        // pl.sayHi()//嗨！小明

        // let p2 = new Person()
        // p2.sayHi()//


        function Person() {
            this.eyes = 2,
                this.head = 1
        }

        function woman() {

        }

        woman.prototype = new Person()
        woman.prototype.bady = function () {
            console.log('你好！');
            return this.eyes
        }

        const man = new woman()
        // 指回原构造函数
        woman.prototype.constructor = woman
        console.log(man.bady())//你好！ 2



    </script>
</body>

</html>